#ifndef __LCD_H__
#define __LCD_H__
#include "main.h"
#include "lvgl.h"


#if 1 
  #define LCD_DEBUG(format, args...) printf("[LCD]-");printf(format, ## args );
#else
  #define LCD_DEBUG(format, args...) ;
#endif

#define LCD_SPI_NUM 0x03
#define LCD_IO_DC 1 //带D/C脚和不带切换

#define LCD_CS      TFT_CS      // Chip select control pin
#define LCD_DC      TFT_DC      // Data Command control pin
#define LCD_BK      TFT_BK       // TFT backlight  pin
#define LCD_RST     TFT_BK    //No use


#define LCD_DC_Clr()    gpio_set_level(LCD_DC, 0)
#define LCD_DC_Set()    gpio_set_level(LCD_DC, 1)

#define LCD_BLK_Clr()  gpio_set_level(LCD_BK, 0)
#define LCD_BLK_Set()  gpio_set_level(LCD_BK, 1)

#define LCD_CS_Clr()  gpio_set_level(LCD_CS, 0)
#define LCD_CS_Set()  gpio_set_level(LCD_CS, 1)

#define USE_HORIZONTAL 0  //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏


#define LCD_W 240
#define LCD_H 240



//画笔颜色
#define WHITE         	 0xFFFF
#define BLACK         	 0x0000	  
#define BLUE           	 0x001F  
#define BRED             0XF81F
#define GRED 			 0XFFE0
#define GBLUE			 0X07FF
#define RED           	 0xF800
#define MAGENTA       	 0xF81F
#define GREEN         	 0x07E0
#define CYAN          	 0x7FFF
#define YELLOW        	 0xFFE0
#define BROWN 			 0XBC40 //棕色
#define BRRED 			 0XFC07 //棕红色
#define GRAY  			  0X8430 //灰色
#define DARKBLUE      	 0X01CF	//深蓝色
#define LIGHTBLUE      	 0X7D7C	//浅蓝色  
#define GRAYBLUE       	 0X5458 //灰蓝色
#define LIGHTGREEN     	 0X841F //浅绿色
#define LGRAY 			     0XC618 //浅灰色(PANNEL),窗体背景色
#define LGRAYBLUE        0XA651 //浅灰蓝色(中间层颜色)
#define LBBLUE           0X2B12 //浅棕蓝色(选择条目的反色)


uint8_t LCD_init(void);
void LCD_WR_data_2byte(uint16_t dat);
void LCD_WR_dataaa(u8 dat,u8 cmd);
void LCD_WR_dataa(u8 dat,u8 cmd);
void LCD_WR_DATA8(u8 dat);
void LCD_WR_REG(u8 dat);
void LCD_WR_DATA(u16 dat);
void LCD_Address_Set(u16 x1,u16 y1,u16 x2,u16 y2);
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color);

void LCD_Fill_Colors(u16 xsta,u16 ysta,u16 xend,u16 yend,lv_color_t* color_p);
void LCD_DrawPoint(u16 x,u16 y,u16 color);
void LCD_Fill_Colors2(u16 xsta,u16 ysta,u16 xend,u16 yend,uint16_t color);
#endif




